-- ----------------------------------------------------------
--
-- Author: czf
-- date: 2018-12-14
-- description: 组合模式-部门类
--
-- ----------------------------------------------------------


Employee = Employee or BaseClass()

function Employee:__init(name, dept, sal)
	self.name = name
	self.dept = dept
	self.salary = sal
	self.subordinates = {}
end

function Employee:Add(e)
	self.subordinates[e.name] = e
end

function Employee:Remove(e)
	if self.subordinates[e.name] then
		self.subordinates[e.name] = nil
	end
end

function Employee:GetSubordinates()
	return self.subordinates
end

function Employee:ToString()
	local str = "Employee :[ Name : ".. self.name ..", dept : ".. self.dept .. ", salary :".. self.salary.." ]"
	return str
end